package br.com.imob.modelo;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author Gilton Nascimento
 */
@Entity
@Table(name = "\"FACE\"", catalog = "imob", schema = "public")
@NamedQueries({
    @NamedQuery(name = "Face.findAll", query = "SELECT f FROM Face f"),
    @NamedQuery(name = "Face.findByFaceId", query = "SELECT f FROM Face f WHERE f.faceId = :faceId"),
    @NamedQuery(name = "Face.findByFace", query = "SELECT f FROM Face f WHERE f.face = :face"),
    @NamedQuery(name = "Face.findLikeByFace", query = "SELECT f FROM Face f WHERE f.face Like :face")
    })
public class Face implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
//  <editor-fold defaultstate="collapsed" desc="Geradores de Sequencias">
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_STORE")
    @SequenceGenerator(name = "SEQ_STORE", sequenceName = "next_face")// </editor-fold>
    @Basic(optional = false)
    @Column(name = "face_id", nullable = false)
    private Integer faceId;
    @Column(name = "face", length = 12)
    private String face;
    @OneToMany(mappedBy = "face", fetch = FetchType.LAZY)
    private List<Imovel> imovelList;

    public Face() {}

    public Face(Integer faceId) { this.faceId = faceId; }

    public Face(String facy) { face = facy; }

	public Face(int id, String facy) {
		faceId = id; face = facy;
	}

	
	public Integer getFaceId() {
        return faceId;
    }

    public void setFaceId(Integer faceId) {
        this.faceId = faceId;
    }

    public String getFace() {
        return face;
    }

    public void setFace(String face) {
        this.face = face;
    }

    public List<Imovel> getImovelList() {
        return imovelList;
    }

    public void setImovelList(List<Imovel> imovelList) {
        this.imovelList = imovelList;
    }
    
    public Object[] getValues() {
    	Object[] objects = {faceId, face};
    	return objects; 
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (faceId != null ? faceId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Face)) {
            return false;
        }
        Face other = (Face) object;
        if ((this.faceId == null && other.faceId != null) || (this.faceId != null && !this.faceId.equals(other.faceId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.imob.modelo.Face[faceId=" + faceId + "]";
    }

}
